<?php
class Adres_model extends CI_Model
{		
	public function newAdres()
	{
		$data = array(
			'postcode' => $this->input->post('postcode'),
			'straat' => $this->input->post('straat'), 
			'huisnummer' => $this->input->post('huisnummer'), 
			'woonplaats' => $this->input->post('woonplaats'),
			'wijk' => $this->input->post('wijk') 
		);
		
		$this->db->insert('adres', $data);
	}
	
	public function updateAdres()
	{
		$date = array(
			'postcode' => $this->input->post('postcode'),
			'straat' => $this->input->post('straat'), 
			'huisnummer' => $this->input->post('huisnummer'), 
			'woonplaats' => $this->input->post('woonplaats'),
			'wijk' => $this->input->post('wijk') 
		);
		
		$this->db->where('adres_id', $this->uri->segment(4));
		$this->db->update('adres', $data);
	}
	
	public function edit_Adres()
	{
		$this->db->where('adres_id', $this->uri->segment(4));
		$query = $this->db->get('adres');

		return $query->result();
	}	
	
	public function deleteAdres()
	{
		$id = $this->uri->segment(3);
		$this->db->query("DELETE FROM adres WHERE adres_id='$id'");
	}

}